package leetcode.code1557;

import java.util.ArrayList;
import java.util.List;

public class Solution {
	public List<Integer> findSmallestSetOfVertices(int n, List<List<Integer>> edges) {
		int[] cnt = new int[n];
		for (int i = 0; i < edges.size(); i++) {
			cnt[edges.get(i).get(1)]++;
		}
		List<Integer> ans = new ArrayList<>();
		for (int i = 0; i < cnt.length; i++) {
			if (cnt[i] == 0) {
				ans.add(i);
			}
		}
		return ans;
	}
}
